]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
calendar: Add public close() method
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 11 Mar 2015 21:11:25 +0000 (22:11 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 12 Mar 2015 16:10:11 +0000 (17:10 +0100)
Currently a message can only be closed by its close button. However
as we want to make a section's clear action synonymous with clicking
the close button of each individual message in the list, we will need
to expose the close action, so add a corresponding method.

https://bugzilla.gnome.org/show_bug.cgi?id=746027

js/ui/calendar.js

index af349665b2ccde6a1822c6fce42ce6089e6e5bbb..dda733c7c18494c8d5c63d6d58064042aab0a307 100644 (file)
@@ -1017,16 +1017,17 @@ const Message = new Lang.Class({
         this._bodyStack.add_actor(this.bodyLabel.actor);
         this.setBody(body);
 
-        this._closeButton.connect('clicked', Lang.bind(this,
-            function() {
-                this.emit('close');
-            }));
+        this._closeButton.connect('clicked', Lang.bind(this, this.close));
         this.actor.connect('notify::hover', Lang.bind(this, this._sync));
         this.actor.connect('clicked', Lang.bind(this, this._onClicked));
         this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
         this._sync();
     },
 
+    close: function() {
+        this.emit('close');
+    },
+
     setIcon: function(actor) {
         this._iconBin.child = actor;
         this._iconBin.visible = (actor != null);
@@ -1158,7 +1159,7 @@ const Message = new Lang.Class({
 
         if (keysym == Clutter.KEY_Delete ||
             keysym == Clutter.KEY_KP_Delete) {
-            this.emit('close');
+            this.close();
             return Clutter.EVENT_STOP;
         }
         return Clutter.EVENT_PROPAGATE;